<?php
/**
 * Created by PhpStorm.
 * User: trisatria
 * Date: 1/7/14
 * Time: 3:50 PM
 */

namespace Admin\Form;
use Zend\Form\Form;
use Zend\Form\Element;
use Admin\Module;

class AdminUserForm extends Form{
    public function __construct($name = null)
    {

        // we want to ignore the name passed
        parent::__construct('AdminUser');
        $this->setAttribute('method', 'post');
        $this->setAttribute('class', 'form-horizontal');

        $this->add(array(
            'name' => 'id',
            'attributes' => array(
                'type'  => 'hidden',

            ),
        ));
        $this->add(array(
            'name' => 'name',
            'attributes' => array(
                'type'  => 'text',
                'class'=>'input-xlarge focused span6 typeahead'
            ),

        ));
        $this->add(array(
            'name' => 'email',
            'attributes' => array(
                'type'  => 'text',
                'class'=>'input-xlarge focused span6 typeahead'
            ),

        ));
        $this->add(array(
            'name' => 'address',
            'attributes' => array(
                'type'  => 'text',
                'class'=>'input-xlarge focused span6 typeahead'
            ),

        ));


        $this->add(array(
            'name' => 'phone',
            'attributes' => array(
                'type'  => 'text',
                'class'=>'input-xlarge focused span6 typeahead'
            ),

        ));

        $this->add(array(
            'name' => 'avatar',
            'attributes' => array(
                'type'  => 'text',
                'class'=>'input-xlarge focused span6 typeahead'
            ),

        ));


        $this->add(array(
            'name' => 'password',
            'attributes' => array(
                'type'  => 'password',
                'class'=>'input-xlarge focused span6 typeahead'
            ),

        ));

        $this->add(array(
            'name' => 'avatar',
            'attributes' => array(
                'type'  => 'file',
                'class'=>'input-xlarge focused span6 typeahead'
            ),

        ));


        $this->add(array(
            'name' => 'submit',
            'attributes' => array(
                'type'  => 'submit',
                'value' => 'Go',
                'id' => 'submitbutton',
                'class' => 'btn btn-primary span3 typeahead'
            ),
        ));
        $select_status = new Element\Select('status');
        $select_status->setAttribute('class','input-xlarge focused span6 typeahead');
        $select_status->setAttribute('id','selU51');
        $select_status->setValueOptions(Module::getUserStatusName());


        $select_us_type = new Element\Select('user_type');
        $select_us_type->setAttribute('class','input-xlarge focused span6 typeahead');
        $select_us_type->setAttribute('id','selU50');
        $select_us_type->setValueOptions(Module::getUserRoleName());

        $this->add($select_status);
        $this->add($select_us_type);
    }
}